getColumnSortInfo
getColumnSortInfo() retrieves the current sorting configuration for a specified column.
const { getColumnSortInfo } = viz;
getColumnSortInfo(columnName: string): ColumnSortInfo
Parameters:
| Property | Type | Required | Description |
|---|---|---|---|
| columnName | string | true | The name of the column to retrieve sort information for |
Returns: ColumnSortInfo object containing sorting details
Throws: Error if the column does not exist in the current schema
ColumnSortInfo Type
The returned object contains the following properties:
interface ColumnSortInfo {
customOrder?: string[];
direction?: 'asc' | 'desc';
}
| Property | Type | Description |
|---|---|---|
| customOrder | string[] | Array defining custom sort order for categorical values |
| direction | 'asc' | 'desc' \ | Sort direction: 'asc' for ascending, 'desc' for descending |
Basic Usage
// Retrieve sort information for a column
const sortInfo = muze.getColumnSortInfo('Sales');
//sortInfo.direction: asc
// Check if a column has a custom sort order
const regionSort = muze.getColumnSortInfo('Region');
//regionSort.customOrder: ['North', 'South', 'East', 'West']